package com.example.capsule_netty.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.capsule_netty.bean.GroupMessageBean;
import com.example.capsule_netty.bean.OneToOneMessageBean;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author: zhuzhiming
 * @Date: 2022/5/3 23:35
 */
public interface GroupMessageMapper extends BaseMapper<GroupMessageBean> {
    @Select(value = "select * from group_message where room_name = #{roomName} ")
    List<GroupMessageBean> getMessagesList(String roomName);

    @Select("select max(id + 0) from group_message where field = #{field} and room_name = #{roomName}")
    int getMaxId(String field, String roomName);


    @Update("update group_message set sign_status = 2 where id = #{id}")
    void recallMessage(int id);

    @Update("truncate table group_message ")
    void truncateTable();
}
